// 定义一个函数

function fn1(a: string): string {
  return a + "aaaa";
}

// 函数赋值给一个变量1
const fn2 = function (b?: number, a: number = 1) {
  console.info(a);
  console.info(b);
};

// 函数赋值给一个变量2
const fn22: (a: boolean) => boolean = function (c: boolean) {
  return c;
};

// 函数赋值给一个变量3
type type3 = (a: boolean) => boolean;
const fn3: type3 = function (c: boolean) {
  return c;
};

//函数赋值给一个变量4 箭头函数
const fn4 = (b: number): boolean => b == 1;
const fn5 = (b: number): boolean => {
  return b === 2;
};

// 参数解构
const fn6 = function ([a, b]: [number, number]): number {
  return a + b;
};
const fn7 = ([a, b]: [number, number]): number => {
  return a + b;
};
